package com.mlan.userap.untils;

import android.util.Log;
import android.view.Gravity;
import android.widget.TextView;

import com.google.gson.Gson;
import com.mlan.userap.AppConfig;
import com.mlan.userap.MyAPP;
import com.mlan.userap.component.FaceManager;
import com.mlan.userap.model.ChatUser;
import com.mlan.userap.model.MsgEntity;
import com.mlan.userap.model.MsgResp;

import java.util.Optional;

public class MsgHelper {
    public  static MsgResp ChangeEntity(Object objdata){
        MsgResp msgEntity = Convert.fromJson(objdata.toString(), MsgResp.class);
        return msgEntity;
    }

    public static String GetText(MsgResp resp){
        String msgcontent="";
        int msgType = resp.getMsgType();

        //1:文本 2:图片  3:音乐 4:视屏 5:文件 6:表情 7:语音 8:时长等 9:
        if (msgType == 1) {
            msgcontent = resp.getMsgContent();
        } else if (msgType == 2) {
            msgcontent = "[图片消息]";
        } else if (msgType == 3) {
            msgcontent = "[语音消息]";
        } else if (msgType == 4) {
            msgcontent = "[视屏消息]";
        } else if (msgType == 5) {
            msgcontent = "[文件消息]";
        }
        else if (msgType == 7) {
            msgcontent = "[语音通话]";
        }
        else if (msgType == 8) {
            msgcontent = "[视屏通话]";
        }
        else{
            msgcontent = "[其它]";
        }
        Log.e("gjf", "GetText: "+new Gson().toJson(resp));
        // Show notification for new messages
        if (resp.getUidFrom() != AppConfig.userId) {
            String title = "新消息";
//            MyAPP.getApp().showNotification(title, msgcontent, resp.getGroupId());
        }
        
        return msgcontent;
    }

}
